
#ifndef RAYTRACER_H
#define RAYTRACER_H

#include"dynarray.h"
#include"raycaster.h"
#include"object.h"
#include"light.h"

class RayTracer
{
  private:
  RayCaster * caster;
  DynArray<Object*> obj_array;
  DynArray<Light*> light_array;
  int max_ref;
  bool Collide(Ray * ray);
  void LightShade (Ray * ray);
  void ExecuteRay (Ray * ray, int nref); 
  float amb;
  public:
  RayTracer (RayCaster * c, int n_ref): caster(c),max_ref(n_ref) {};
  void SetAmb (float a)
  {
    amb = a;
  };
  void InsertObj (Object * o)
  {
    obj_array.append(o);
  };
  void InsertLight (Light * o)
  {
    light_array.append(o);
  };
  void Execute (int x0, int x1, int y0, int y1, float * img,int w, int h, bool aa);
};

#endif
